package org.boyan.modules.cgform.converter.bc;

import java.util.ArrayList;
import java.util.List;
import org.boyan.common.system.api.ISysBaseAPI;
import org.boyan.common.system.vo.DictModel;
import org.boyan.common.util.SpringContextUtils;
import org.boyan.common.util.oConvertUtils;
import org.boyan.modules.cgform.entity.OnlCgformField;

public class b extends org.boyan.modules.cgform.converter.ac.b {
    public b(OnlCgformField paramOnlCgformField) {
        ISysBaseAPI iSysBaseAPI = (ISysBaseAPI)SpringContextUtils.getBean(ISysBaseAPI.class);
        String str1 = "SYS_DEPART";
        String str2 = "DEPART_NAME";
        String str3 = "ID";
        List<DictModel> list = iSysBaseAPI.queryTableDictItemsByCode(str1, str2, str3);
        this.b = list;
        this.a = paramOnlCgformField.getDbFieldName();
    }

    public String converterToVal(String txt) {
        if (oConvertUtils.isEmpty(txt)) {
            return null;
        }
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str1 : txt.split(",")) {
            String str2 = super.converterToVal(str1);
            if (str2 != null) {
                arrayList.add(str2);
            }
        }
        return String.join(",", arrayList);
    }

    public String converterToTxt(String val) {
        if (oConvertUtils.isEmpty(val)) {
            return null;
        }
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str1 : val.split(",")) {
            String str2 = super.converterToTxt(str1);
            if (str2 != null) {
                arrayList.add(str2);
            }
        }
        return String.join(",", arrayList);
    }
}
